from datetime import datetime
import connect
conn = connect.connect()

# 创建一个游标对象
cursor = conn.cursor()

# 插入数据
def insert_data(data):
    values = list(data.values())
    insert_query = "INSERT INTO unresolved_sentence (ip, sentence, create_time, update_time) VALUES (%s, %s, %s, %s)"
    try:
        cursor.execute(insert_query, values)
        conn.commit()
        print("插入成功")
    except:
        print("插入失败")

# obj = {
#     "ip": "127.0.0.1",
#     "sentence": "酒桶和女警都可以打下路吗？",
#     "create_time": datetime.now(),
#     "update_time": datetime.now()
# }
# insert_data(obj)